<%@ page contentType="text/html;charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xn="http:///www.renren.com/2009/xnml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/renren_js_sdk/renren.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
	    var uiOpts = {
				url : "http://graph.renren.com/oauth/authorize",
				display : "iframe",
				params : {
					"response_type" : "token",
					"client_id" : "${appId}"
				},
				onSuccess : function(r) {},
				onFailure : function(r) {}
			};
			Renren.ui(uiOpts);
	    
		Renren.init({appId:${appId}});
		setInterval('qadd();', 2000);
		var inputValue = $.trim($('#inputValue').val());
		$('#inputValue').focus(function(){
				$('#inputValue').attr('value', '');
			}).blur(function(){
				var blurValue = $.trim($('#inputValue').val());
				if (blurValue == '' || blurValue == inputValue) { 
					$('#inputValue').attr('value', inputValue);		
				}
		});
		
		$("#startTest").click(function() {
				var name = $.trim($('#inputValue').val());
				if (name == '输入你想测试的名字' || name == '') {
					alert("请输入你的名字");
					return false;
				}else{
					$("#form").attr("action","result");
					$("#form").submit();
				}
			});
	});
	//测试人数
	function qadd() {
		var num = $('#qapp-num').text();
		num = parseInt(num) + Math.round(3 * Math.random(1, 2));
		$('#qapp-num').text(num);
	}
	
	function sendRequest(isSendToMany, toId) {
	      var params = {"accept_url":"http://apps.renren.com/guakezhishu/home","accept_label":"接受邀请"};
	      var style = null;
	      if (isSendToMany) {
	          params["actiontext"] = "邀请好友来玩吧";
	      }
	      else {
	          params["to"] = toId;
			  style = {
				  "width":500,  
				  "height":350  
			  };
	      }
		  var uiOpts = {
			  url : "request",
			  display : "iframe",
			  params : params,
			  style : style,
			  onSuccess: function(r){},
			  onFailure: function(r){} 
		  };
		  Renren.ui(uiOpts);
	    }
</script>
</head>
<body id="bg1">
	<div id="webapp-wrapper">
		<div id="webapp-top"></div>
		<div id="webapp-main">
			<div class="top">
				<!--a:站内应用-->
				<a href="###" target="_blank" class="logo">美丽说</a>
				<!--end of a-->
			</div>
			<div class="main-content">
				<div class="user_input mt20">
					<div class="user_id left">
						<form method="post" id="form">
						<input type="text" value="输入你想测试的名字" id="inputValue" name="name"/>
						</form>
					</div>
					<a href="###" id="startTest" class="left startBtn"></a>
				</div>
				<div class="clear"></div>
				<div class="pngBg count c">
					测试人数:<span id="qapp-num" class="red mr20">1346559</span>
					准确率:<span class="red">93%</span>
				</div>
			</div>
		</div>
	</div>
	<!--<a href="javascript:sendRequest(true)">邀请更多好友...</a>  -->
</body>
</html>